<template>
	<view>
		<new-list @itemClick="goDetail" :list="newList"></new-list>
	</view>
</template>

<script>
	import newList from '@/components/news_item/news_item.vue'
export default {
	data() {
		return {
			newList: []
		};
	},
	components:{"new-list":newList},
	onLoad() {
		this.getNews();
	},
	methods: {
		async getNews() {
			const res = await this.$myRuquest({
				url: '/api/getnewslist'
			});
			this.newList = res.data.message;console.log(res)
		},
		goDetail(id){
		console.log(id)
			uni.navigateTo({
				url:'/pages/news-detail/news-detail?id='+id
			})
		}
	}
};
</script>

<style lang="scss">
.news {
	.news_item {
		display: flex;
		padding: 10rpx 20rpx;
		border-bottom: 1px solid $shop_color;
		image {
			max-width: 200rpx;
			min-width: 200rpx;
			height: 150rpx;
		}
		.right {
			margin-left: 15rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			.tit {
				font-size: 30rpx;
			}
			.info {
				font-size: 24rpx;
				text:nth-child(2) {
					margin-left: 30rpx;
				}
			}
		}
	}
}
</style>
